package xjtu.se.articlecommunity.common.impl;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import xjtu.se.articlecommunity.common.CacheService;

@Service
@Transactional
@CacheConfig(cacheNames = "verifyCode")
public class CacheServiceImpl implements CacheService {
    @Override
    @CachePut(key = "#key")
    public String saveVerificationCode(String key, String code) {
        return code;
    }

    @Override
    @Cacheable(key = "#key")
    public String findVerificationCode(String key) {
        return null;
    }

    @Override
    @CacheEvict(key = "#key")
    public void clearVerificationCode(String u_id) {
        return;
    }
}
